<extend name="./Common/iframe"/>
<block name="css">
    <script src="__PUBLIC__/plugins/markdown/examples/js/jquery.min.js"></script>
    <script src="__PUBLIC__/plugins/markdown/editormd.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/plugins/markdown/css/editormd.min.css" />
</block>
<block name="container">
    <div id="container">
        <fieldset class="layui-elem-field">
            <legend>{$title}</legend>
            <div class="layui-field-box">
                <form class="layui-form" action="" event="articForm" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required  lay-verify="required" placeholder="请输入文章标题" value="{$data.title}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">关键词</label>
                        <div class="layui-input-block">
                            <input type="text" name="keyword" required  placeholder="请输入关键词，用逗号隔开，最多5个哦" value="{$data.keyword}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">摘要</label>
                        <div class="layui-input-block">
                            <textarea type="text" name="description" required  placeholder="请输入内容摘要" value="{$data.description}" autocomplete="off"  class="layui-textarea">{$data.description}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">所属分类</label>
                        <div class="layui-input-inline">
                            <select id="channel" name="channel_id" lay-verify="">
                                <option value="">请选择</option>
                                <volist name="channels" id="channel">
                                    <option value="{$channel.id}">{$channel.title}</option>
                                </volist>

                            </select>
                        </div>
                        <label class="layui-form-label">作者</label>
                        <div class="layui-input-inline">
                            <input type="text" name="author" required  placeholder="请输入本文作者" value="{$data.author}" autocomplete="off"  lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">推荐:</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="hot" value="1" lay-skin="switch" >
                        </div>
                        <label class="layui-form-label">置顶:</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="top" value="1" lay-skin="switch" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">内容</label>
                        <div class="layui-input-block">
                            <div id="test-editormd">
                                <textarea style="display:none;" name="content">{$data['content']}</textarea>
                                <!-- 第二个隐藏文本域，用来构造生成的HTML代码，方便表单POST提交，这里的name可以任意取，后台接受时以这个name键为准 -->
                                <textarea class="editormd-html-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                    <input name="id" style="display: none" type="text" />
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="button" event="submit" class="layui-btn" lay-submit lay-filter="add">发布</button>
                            <button type="button" event="draft" class="layui-btn layui-btn-warm" lay-submit lay-filter="draft">保存草稿</button>
                            <if condition="$Think.get.draft eq 1">
                                <a href="{:U('draft')}" class="layui-btn layui-btn-danger">返回</a>
                            <else />
                                <a href="{:U('index')}" class="layui-btn layui-btn-danger">返回</a>
                            </if>

                        </div>
                    </div>
                </form>
            </div>
        </fieldset>
    </div>
</block>